{% extends "park/base.html" %}
{% block content %}
<script type="text/javascript">
    var primary_menu = "menu_1";
    var sub_menu = "menu_1_0";
</script>
<div class="col-md-12">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <div class="panel-title"><h3>企业基本信息</h3></div>
        </div>
        <div class="panel-body">
            <div class="row">
                <div class="col-md-12">
                    <form role="form" action="/park/submitEidtPark/" method="post" enctype="multipart/form-data" class="form-horizontal form-groups-bordered">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">用户名</label>
                            <div class="col-sm-5">
                                <input type="text" name="username" value="{{ enterprise.user.username }}" class="form-control"  placeholder="请输入登陆用户名" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">密码</label>
                            <div class="col-sm-5">
                                <input type="text" name="password" value="{{ enterprise.user.password }}" class="form-control"  placeholder="请输入登陆密码" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">企业名称</label>
                            <div class="col-sm-5">
                                <input type="hidden" name="enterprise_id" value="{{ enterprise.id }}"/>
                                <input type="text" name="enterprise_name" value="{{ enterprise.name }}" class="form-control"  placeholder="请输入企业名称" />
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">是否禁用</label>
                            <div class="col-sm-5">
                            <input type="checkbox" value="1" name="disable"
                                   {% if enterprise.disable == '1' %}
                                   checked="checked"
                                    {%endif %}>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-3 col-sm-5">
                                <input onclick="submitSave()" type="submit" class="btn btn-orange btn-lg" value="暂存">
                                <input type="submit" class="btn btn-success btn-lg" value="保存">
                                <input class="btn btn-info btn-lg" type="reset" value="重置"/>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

</div>
{% endblock %}

{% block js %}
<script language="javascript">
    var dizhi = "{{basic.facilities_add0}}";
    $(function(){
        var flag = $("input[name='parent_company']:checked").val();
        if (flag==1) {
            $(".parentCompany").show();
            $(".parentCompany").eq(0).find("input").attr("datatype","*");
            $(".parentCompany").eq(1).find("input").attr("datatype","n");
        }else{
            $(".parentCompany").hide().find("input").removeAttr('datatype');
        }
        $("input[name='parent_company']").click(function(){
            var flag = $("input[name='parent_company']:checked").val();
            console.log(flag)
            if (flag==1) {
                $(".parentCompany").show();
                $(".parentCompany").eq(0).find("input").attr("datatype","*");
                $(".parentCompany").eq(1).find("input").attr("datatype","n");
            }else{
                $(".parentCompany").hide().find("input").removeAttr('datatype');
            }
        })
        
    });
    function getNextElement (field) {
        var form = field.form;
        for (var e = 0; e < form.elements.length; e++)
            if (field == form.elements[e])
                break;
        return form.elements[++e % form.elements.length];
    }
    


</script>
{% endblock %}
